<template>
	<view>
		<view style="height: 16rpx;"></view>

		<view class="feedback-view">
			<view class="feedback-title">问题描述</view>
			<textarea v-model="content" placeholder="请从多个角度写下您的反馈内容吧~" />
		</view>

		<view class="set-view">
			<view class="set-title">添加图片</view>
			<view class="set-upload">
				<UploaderImg
					ref="upload"
					class="upload-view"
					upload_img_wh="width: 123rpx;height: 123rpx;"
					:upload_count="1"
					:upimg_bj="$getImgUrl('mine/ic_tjtp.png')"
					@change="onImgChange"
				></UploaderImg>
			</view>
		</view>

		<button type="default" class="default-btn" @click="onSubmit">提交</button>
		<view class="fankui" @click="$navTo('pages/mine/feedback-list/feedback-list')">反馈回复记录 ></view>
	</view>
</template>

<script>
import UploaderImg from '@/components/iz-aloss-uploader-img/iz-aloss-uploader-img.vue';
export default {
	components: {
		UploaderImg
	},
	data() {
		return {
			content: '',
			img: ''
		};
	},
	methods: {
		async onSubmit() {
			if (!this.content) return this.$toast('请输入内容');

			var res = await this.$post('server/index/addwenti', {
				content: this.content,
				img: this.img
			});
			if (res.errcode != 0) {
				this.$toast(res.errmsg);
				return;
			}

			this.$toast('提交成功');
			setTimeout(() => {
				uni.navigateBack();
			}, 1000);
		},
		onImgChange(data) {
			console.log('data====', data);
			this.img = data.details[0].imgurl;
		}
	}
};
</script>

<style lang="scss">
@import '../set/set.scss';
.feedback-view {
	background: #ffffff;
	border-radius: 20rpx;
	margin: 20rpx 30rpx;
	padding: 47rpx 43rpx;
	.feedback-title {
		font-size: 30rpx;
		font-weight: 500;
		color: #333333;
	}
	textarea {
		margin-top: 35rpx;
		font-size: 26rpx;
	}
}
.default-btn {
	margin-top: 94rpx;
}
.set-view {
	padding: 30rpx;
	.set-title {
		color: #999;
	}
	.set-upload {
		display: flex;
		justify-content: flex-end;
	}
}
.fankui {
	text-align: center;
	margin-top: 50rpx;
	font-size: 26rpx;
}
</style>
